package com.bgs.eat.userProtal.mapper;

import com.bgs.eat.config.BaseMapper;
import com.bgs.eat.userProtal.entity.UserProtalEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserProtalMapper extends BaseMapper<UserProtalEntity> {
    @Select("<script>" +
            "select u.*\n" +
            "from user_protal u\n" +
            "left join riderinformation r\n" +
            "on u.id = r.user_protal_id\n" +
            "where u.role = 3 and u.audit_id = 5 and u.del_flag = 0 and r.county_id = #{countyId}" +
            "<when test='userName != &quot;&quot; and userName != null'>" +
            "and user_name like '%${userName}%'</when>" +
            "</script>")
    List<UserProtalEntity> selectRegionByUserProtal(@Param("userName")String userName, @Param("countyId")Integer countyId, Integer roleId);
}
